package com.example.shop_2211.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy.REPLACE
import androidx.room.Query
import androidx.room.Update
import com.example.base.entity.LoginEntity


/**
 * 数据库---DAO  用户表的增删改查操作
 */
@Dao
interface UserDao {

    @Insert(onConflict = REPLACE)
    fun insertUser(loginEntity: LoginEntity)

    @Update
    fun updateUser(loginEntity: LoginEntity)

    @Delete
    fun deleteUser(loginEntity: LoginEntity)

    @Query("select * from user where phone = :phone")
    fun queryByPhone(phone:String):List<LoginEntity>


    @Query("delete from user ")
    fun deleteAll()//删除所有

}